package com.hcy.rabbitruntimeapi.model.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @Author huchenying
 * @Description map放websocketChannel的key
 * @Date 2021/12/21 12:34
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WebSocketKey {

    /**
     * 用户名
     */
    private String username;

    /**
     * 客户端id
     */
    private String clientId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WebSocketKey that = (WebSocketKey) o;
        return Objects.equals(username, that.username) &&
                Objects.equals(clientId, that.clientId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(username, clientId);
    }
}
